package com.dd.service.Impl;

import com.dd.entity.User;
import com.dd.mapper.UserMapper;
import com.dd.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public List<User> selectUserAll() {
        System.out.println("查询全部学生信息");
        return userMapper.selectUserAll();
    }

    @Override
    @Transactional
    public void insertUser(String name) {
        System.out.println("添加学生");
        User user = new User();
        user.setName(name);
        userMapper.insertUser(user);
    }
}
